#ifndef __SPI_H__
#define __SPI_H__


#define SPI_PAGE	0x0f

/*
#define SPI_READMODE		0x00
#define SPI_MCUCLOCKSEL		0x01
#define SPI_SPICLOCKSEL		0x02
#define SPI_DMAMODE			0x03
#define SPI_COMMAND			0x04
#define SPI_WAIT			0x05
#define SPI_BUFADDRH		0x06
#define SPI_BUFADDRL		0x07
#define SPI_DATACNTH		0x08
#define SPI_DATACNTL		0x09
#define SPI_CMDBUFFER		0x0a
#define SPI_DEFBUFFER		0x10
#define SPI_STATUSCMD		0x18
#define SPI_BUSYCONFIG		0x19
#define SPI_MCUCONFIG		0x20
#define SPI_PASSWORD		0x21
*/

BYTE SPI_SetModeByRegister(void);
void SPI_Init(void);
void SPI_TurboInit(void);
void SPI_QUADInit(void)	;

void SPI_ReadData2Reg(DWORD spiaddr, WORD index, DWORD cnt);
void SPI_ReadData2RegInc(DWORD spiaddr, WORD index, DWORD cnt);
void SPI_ReadData2xdata(DWORD spiaddr, BYTE *ptr, DWORD cnt);

void SPI_WriteEnable(void);
void SPI_SectorErase(DWORD spiaddr);
void SPI_BlockErase(DWORD spiaddr);
void SPI_PageProgram(DWORD spiaddr, BYTE *ptr, WORD cnt);


void SPI_SetAccess(void);
void SPI_RevertAccess(void);

#ifdef address_32bit //erek for 4byte address spi, 20121214
void SPI_Addr32Enable();
#endif




#endif // __SPI_H__
